﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Medianamik.Core;
using System.Globalization;
using System.Collections.ObjectModel;

namespace Medianamik.UI
{
	public class MenuGroup : SystemNode<MenuGroup>
	{
		#region .ctors

		public MenuGroup()
			: base()
		{ }

		#endregion
		private static Guid _systemNodeTypeID = new Guid("C0B56F78-44EB-4E20-A1A8-3E0D56F008A3");
		public override Guid SystemNodeTypeID
		{
			get { return _systemNodeTypeID; }
		}

		public override string DefaultCulture
		{
			get
			{
				return CultureInfo.InvariantCulture.Name ;
			}
		}

		#region Propriété Neutres

		public string CssClass
		{
			get
			{
				return DefaultInstance.Properties["CssClass"].GetValue<string>();
			}
			set
			{
				DefaultInstance.Properties["CssClass"].SetValue(value);
			}
		}

        public string ImageUrl
        {
            get
            {
                return DefaultInstance.Properties["ImageUrl"].GetValue<string>();
            }
            set
            {
                DefaultInstance.Properties["ImageUrl"].SetValue(value);
            }
        }

        public string SelectedImageUrl
        {
            get
            {
                return DefaultInstance.Properties["SelectedImageUrl"].GetValue<string>();
            }
            set
            {
                DefaultInstance.Properties["SelectedImageUrl"].SetValue(value);
            }
        }

        public string MasterPanelImageUrl
        {
            get
            {
                return DefaultInstance.Properties["MasterPanelImageUrl"].GetValue<string>();
            }
            set
            {
                DefaultInstance.Properties["MasterPanelImageUrl"].SetValue(value);
            }
        }

		public string Name
		{
			get
			{
				return DefaultInstance.Properties["Name"].GetValue<string>();
			}
			set
			{
				DefaultInstance.Properties["Name"].SetValue(value);
			}
		}

		#endregion 

		private Collection<MedianamikPage> _pages;
		public Collection<MedianamikPage> Pages
		{
			get
			{
				if (_pages == null)
				{
					_pages = new Collection<MedianamikPage>(NodeManager.GetChildNodes<MedianamikPage>(ID, MedianamikTypes.MedianamikPage, false, 1));
				}

				return _pages;
			}
		}
	}
}
